using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableActivityNewOpen7DayDao:DaoBase<TableActivityNewOpen7Day>
    {
        public override void AddPrimaryIndex(TableActivityNewOpen7Day model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableActivityNewOpen7Day.txt";
        }

        protected override TableActivityNewOpen7Day ParseRowData(string[] rowData)
        {
            TableActivityNewOpen7Day data = new TableActivityNewOpen7Day();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.id = 0;
            }
            else
            {
                data.id = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.titleId = 0;
            }
            else
            {
                data.titleId = int.Parse(rowData[1]);
            }

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.taskType = 0;
            }
            else
            {
                data.taskType = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.tap = 0;
            }
            else
            {
                data.tap = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.openDay = 0;
            }
            else
            {
                data.openDay = int.Parse(rowData[4]);
            }
			data.num = rowData [5];

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.isVisable = 0;
            }
            else
            {
                data.isVisable = int.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.oldPrice = 0;
            }
            else
            {
                data.oldPrice = long.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.newPrice = 0;
            }
            else
            {
                data.newPrice = long.Parse(rowData[8]);
            }
			data.discount = rowData [9];
			data.reward = rowData [10];

            return data;
        }


        public override void AddOneIndex(TableActivityNewOpen7Day model)
        {
            if (!cacheOneIndex.ContainsKey(model.openDay.ToString()))
            {
                cacheOneIndex[model.openDay.ToString()] = new List<TableActivityNewOpen7Day>();
            }
            cacheOneIndex[model.openDay.ToString()].Add(model);
        }
    

    }

}
